package day08;

public class Demo10 {

	public static void main(String[] args) {
		System.out.println(test("5"));
		System.out.println(test("5A"));
		System.out.println(test("A"));
		System.out.println(test(""));
		System.out.println(test(null));

	}

	public static int test(String s) {
		try {
			int n = s.charAt(0) - '0';
			return n;
		} catch (NullPointerException e) {

			return -1;

		}catch(RuntimeException e){
			return -2;
		}

	}

}
